Component({
  options: {
    addGlobalClass: true,
    multipleSlots: true
  },
  properties: {
    title: String,
    value: {
      type: null,
      value: ''
    },
    required: Boolean,
    placeholder: {
      type: String,
      value: '请选择',
    },
    inset: Boolean,
    showLink: {
      type: Boolean,
      value: true
    },
    showClear: {
      type: Boolean,
      value: true
    },
    disabled: Boolean,
    useRightIcon: Boolean
  },
  data: {
  },
  methods: {
    onChange(event) {
      this.setData({
        value: event.detail.value
      })
      this.bindChange();
    },

    onClear() {
      this.setData({
        value: ''
      })
      this.bindChange()
      this.triggerEvent('clear')
    },

    bindChange() {
      this.triggerEvent('change', this.data.value);
    }
  }
})